#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
#include<conio.h>
#include<graphics.h>

int main()
{
	float x = 20;
	float y = 200;
	float g = 0.5;
	float vx = 10;
	float vy = 1;
	initgraph(600, 600);
	while (1)
	{
		cleardevice();
		vy = vy + g;
		y = y + vy;
		x = x + vx;
		if (y >= 580 || y <= 20)
		{
			vy = -vy;
		}
		if (y > 580)
		{
			y = 580;
		}
		if (x >= 580 || x <= 20)
		{ 
			vx = -vx;
		}
		if (x > 580)
		{
			x = 580;
		}
		if (x < 20)
		{
			x = 20;
		}
		fillcircle(x, y, 20);
		Sleep(10);
	}
	_getch();
	closegraph();
	return 0;
}